<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="">
  <meta name="author" content="">
  <link rel="icon" href="../../favicon.ico">
  <title>美食信息管理系统</title>
  <link href="assets/css/bootstrap.min.css" rel="stylesheet">
  <link href="assets/css/play.css" rel="stylesheet">
  <link href="assets/css/offcanvas.css" rel="stylesheet">
  <link href="assets/css/style.css" rel="stylesheet">
  <script src="assets/js/jquery.min.js"></script>
  <script src="assets/js/ie8-responsive-file-warning.js"></script>
  <script src="assets/js/ie-emulation-modes-warning.js"></script>
  <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
</head>
﻿<body>
<?php require_once('./tpl/head.php'); 
require_once('./tpl/foot.php'); 
?>
<nav class="navbar navbar-fixed-top navbar-inverse">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>   
    </div>
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <?php
      require_once('system/dbConn.php');
      connect();
      $sql="select * from noveltype";
      $rs=mysql_query($sql)or die('查询 1 失败！'.mysql_error());
      ?>
      <ul class="nav navbar-nav">
        <li><a href="index.php">首页</a></li>
        <?php
        while($row=mysql_fetch_assoc($rs))
        {
          ?>
          <li><a href="list.php?tid=<?php
            echo $row["tid"];
            ?>
            "><?php
            echo $row["typename"];
            ?>
          </a></li>
          <?php
        }
        ?>
      </ul>   
      <form action="search.php" class="navbar-form navbar-left" role="search">
        <div class="form-group">
          <input type="text" class="form-control" name="foodname" placeholder="Search">
        </div>
        <button type="submit" class="btn btn-default">搜索</button>
      </form>
      <ul class="nav navbar-nav navbar-right">
        <li class="active"><a href="">欢迎<?php
          session_start();
          if(isset($_SESSION["user"]))
            echo " ".$_SESSION["user"]." ";
          else{
            echo "您";
          }
          ?>访问本网站</a>
        </li>
        <?php
        if(isset($_SESSION["user"]))
        {
          ?>
          <li><a href="logout.php">注销</a></li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
            aria-haspopup="true" aria-expanded="false">个人中心 <span class="caret"></span></a>
            <ul class="dropdown-menu">
              <li><a href="#" data-toggle="modal" data-target="#changePassword">修改个人密
                码</a></li>
                <li><a href="#" data-toggle="modal" data-target="#changeInfor">修改个人信息
                </a></li>
                <li><a href="myCommentList.php">我的评价</a></li>
              </ul>
            </li>
            <?php
          }else{
            ?>
            <li><a href="#" data-toggle="modal" data-target="#login">登录</a></li>
            <li><a href="#" data-toggle="modal" data-target="#reg">注册</a></li>
            <?php
          }
          ?>  
        </ul>
      </div>
    </div>
  </nav>


  <!-- 修改个人信息 -->
  <!-- <?php
  $uname=$_SESSION["uname"];
  $sql = "select * from users where uname='$uname'";   
  $result = mysql_query($sql) or die('查询失败！'.mysql_error());  
  $row = mysql_fetch_assoc($result);
  $uid=$row['uid'];
  $gender = $row['gender'];
  $birthdate = $row['birthdate'];
  $hobby = $row['hobby'];
  $degree = $row['degree'];
  $intro = $row['intro'];
  $pic = "./images/".$row['pic'];      
  ?>
  <div class="modal fade" id="changeInfor" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" id="myModalLabel">请修改您的注册信息</h4>
        </div>
        <div class="modal-body">

          <form method="post"  class="form-horizontal" action="doChangeInfor.php"  enctype="multipart/form-data">
            <input type="hidden" name="uid" value=<?php  echo $uid;  ?>>  

            <div class="form-group">
              <label for="uname" class="col-md-2 control-label">用户名</label>
              <div class="col-md-10">
               <input type="text" class="form-control" id="uname" readonly="readonly" name="uname" value=<?php  echo $uname;  ?>>
             </div>
           </div>

           <div class="form-group">
            <label  class="col-md-2 control-label">性别</label>
            <div class="col-md-10">
              <label class="radio-inline">
               <input type="radio"  name="gender" value="0" <?php  if(!$gender) echo 'checked';  ?>>男</label>
               <label class="radio-inline">
                 <input type="radio"  name="gender" value="1" <?php  if($gender) echo 'checked';  ?>>女</label>
               </div>
             </div>

             <div class="form-group">
              <label  class="col-md-2 control-label">生日</label>
              <div class="col-md-10">
                <input type="date" name="birthdate" class="form-control"  value=<?php  echo $birthdate;  ?>>
              </div>
            </div>

            <div class="form-group">
              <label  class="col-md-2 control-label">爱好</label>
              <div class="col-md-10">
               <label class="checkbox-inline">
                 <input type="checkbox" name="hobby[]" value="旅游" <?php  if(strstr($hobby,'旅游')) echo 'checked';  ?>>旅游
               </label>
               <label class="checkbox-inline">
                 <input type="checkbox" name="hobby[]" value="登山" <?php  if(strstr($hobby,'登山')) echo 'checked';  ?>>登山
               </label>
               <label class="checkbox-inline">
                <input type="checkbox" name="hobby[]" value="健身" <?php  if(strstr($hobby,'健身')) echo 'checked';  ?>>健身
              </label>
              <label class="checkbox-inline">
                <input type="checkbox" name="hobby[]" value="上网" <?php  if(strstr($hobby,'上网')) echo 'checked';  ?>>上网
              </label>
              <label class="checkbox-inline">
                <input type="checkbox" name="hobby[]" value="游泳" <?php  if(strstr($hobby,'游泳')) echo 'checked';  ?>>游泳
              </label>
            </div>
          </div>

          <div class="form-group">
            <label  class="col-md-2 control-label">学历</label>
            <div class="col-md-10">    
             <select name="degree">
              <option value="0">---请选择---</option>
              <option value="1" <?php  if($degree=='1') echo 'selected';  ?>>高中</option>
              <option value="2" <?php  if($degree=='2') echo 'selected';  ?>>大学</option>
              <option value="3" <?php  if($degree=='3') echo 'selected';  ?>>研究生</option>
              <option value="4" <?php  if($degree=='4') echo 'selected';  ?>>博士生</option>
            </select>
          </div>
        </div>

        <div class="form-group">
          <label  class="col-md-2 control-label">自我介绍</label>
          <div class="col-md-10">    
            <textarea name="intro" class="form-control" cols="40" rows="5"><?php  echo $intro;  ?></textarea>
          </div>
        </div>

        <div class="form-group">
          <label  class="col-md-2 control-label">头像</label>
          <div class="col-md-10">    
           <input type="file" name="pic">
           原头像：<img src="images/<?php
           echo $row["pic"];
           ?>" width="80px" height="80px" class="img-circle">
         </div>
       </div>

       <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
          <input type="submit"  class="btn btn-default" value="更新">
        </div>
      </div>

    </form>
    <?php
    if(isset($_GET["msg7"])){
      echo'<h1 style="color:red;">'.$_GET["msg7"]."</h1>";
    }
    ?>

    <?php
    if(isset($_GET["msg8"])){
      echo '<h1 style="color:red;">'.$_GET["msg8"]."</h1>";
    }
    ?> 
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-default" onclick="location.replace('index.php')" data-dismiss="modal">关闭</button>

  </div>
</div>
</div>
</div>  
 -->
<!-- 留言显示0 -->
<?php  


connect();
session_start();
$u=$_SESSION["user"];
$sql="select * from users where uname='$u' ";
$resul=mysql_query($sql) or die('查询失败！'.mysql_error());
$ro=mysql_fetch_assoc($resul);
$uid=$ro["uid"];


$sql="select * from comments where uid='$uid'";
$result=mysql_query($sql);


$totalrows=mysql_num_rows($result);
$page=$_REQUEST['page'];
if(!isset($page))
$page=1;
$rowsperpage=2;
$start=($page-1)*$rowsperpage;
$sql.="limit {$start},{$rowsperpage}";
$result=mysql_query($sql) or die('查询失败！'.mysql_error());
if($totalrows)
  { echo  '<div class="container-fluid control-label col-md-12 "><h1 class="text-center" style="color:white;">留言列表</h1>
<table class="table  table-bordered">
 <tr class="info">
   <th>序号</th>
   <th>评价内容</th>
   <th>发表评论的时间</th>
   <th>小说名称</th>
   <th>操作</th>
 </tr> ';
 while($row=mysql_fetch_assoc($result))
 {
  echo '<tr class="success">';
  foreach ($row as $k => $value)
  {
    if($k=='uid')
      continue; 
    elseif($k=='nid')
    {
      $sql2='select * from novels where nid="'.$value.'"';
      $result2=mysql_query($sql2);
      while($row2=mysql_fetch_assoc($result2))
        {foreach ($row2 as $ke => $value2)
          if($ke=='novelname')
            $value=$value2;}
        }

        echo '<td>'.$value.'</td>';
    }
      echo '<td><a href="commentEditForm.php?id='.$row['cid'].'">修改|</a><a href="commentDelete.php?id='.$row['cid'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a></td>';
      echo '</tr>';
    }
    echo '</table>';
    if($rowsperpage>=$totalrows)
      $totalpages=1;
    else
      $totalpages=ceil($totalrows/$rowsperpage);
    echo '<nav><ul class="pager">';

    
    echo '</ul></nav>';
    
    // echo '<form method=post method="myCommentList.php" enctype="multipart/form-data" class="form-horizontal">
    // <div align="right" class="form-group">
    //   <div class="col-md-offset-11 col-md-1">
    //     <input  type="text" name="page" class="form-control"></div>
    //     <input type="submit" class="btn btn-success btn-xs" value="转到">
    //   </div>
    // </form>';
  }
  else    
    echo  '<h3 align="center" style="color:red;">您尚未评价任何影片，找不到您的评论记录</h3><hr>';
  ?>
</div>
<script src="./assets/js/jquery.min.js"></script>
<script src="./assets/js/bootstrap.min.js"></script>
<script src="./assets/js/ie10-viewport-bug-workaround.js"></script>
<script src="./assets/js/offcanvas.js"></script>
<script>
  $('.carousel').carousel({
        interval: 3000 
      })
    </script>
  </body>
  </html>
